Skip to content

fix(task-processor): prevent runaway tasks with 3 elapsed-time and to…#186

Merged
PetrAnto merged 1 commit intomainfrom
claude/review-model-sync-aPCT2
Feb 25, 2026
Merged

fix(task-processor): prevent runaway tasks with 3 elapsed-time and to…#186
PetrAnto merged 1 commit intomainfrom
claude/review-model-sync-aPCT2

Conversation

@PetrAnto
Copy link
Owner

…ol-limit fixes

Bug 1: startTime reset on every auto-resume — each processTask() call created a new TaskState with startTime=Date.now(), so the elapsed time cap (15min free / 30min paid) never triggered across resumes. Fix: preserve startTime from the original task when resuming.

Bug 2: elapsed time cap only checked when task appears stuck — the alarm handler returned early ("still active") before reaching the elapsed check. Fix: move elapsed check before the "still active" early return so it fires regardless of task activity.

Bug 3: no total tool call limit — a model could make unlimited tool calls across its lifetime. Fix: add MAX_TOTAL_TOOLS_FREE=50 and MAX_TOTAL_TOOLS_PAID=100 with a nudge message when exceeded.

Also adds defense-in-depth elapsed check in the main processTask loop.

These bugs caused a 2-file GitHub read to take 46 minutes with 8 auto-resumes and 29 tool calls instead of stopping at the time cap.

https://claude.ai/code/session_01K2mQTABDGY7DnnposPdDjw

…ol-limit fixes

Bug 1: startTime reset on every auto-resume — each processTask() call
created a new TaskState with startTime=Date.now(), so the elapsed time
cap (15min free / 30min paid) never triggered across resumes. Fix:
preserve startTime from the original task when resuming.

Bug 2: elapsed time cap only checked when task appears stuck — the
alarm handler returned early ("still active") before reaching the
elapsed check. Fix: move elapsed check before the "still active"
early return so it fires regardless of task activity.

Bug 3: no total tool call limit — a model could make unlimited tool
calls across its lifetime. Fix: add MAX_TOTAL_TOOLS_FREE=50 and
MAX_TOTAL_TOOLS_PAID=100 with a nudge message when exceeded.

Also adds defense-in-depth elapsed check in the main processTask loop.

These bugs caused a 2-file GitHub read to take 46 minutes with 8
auto-resumes and 29 tool calls instead of stopping at the time cap.

https://claude.ai/code/session_01K2mQTABDGY7DnnposPdDjw
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@PetrAnto PetrAnto merged commit 3e082a8 into main Feb 25, 2026
0 of 5 checks passed
@github-actions
Copy link

E2E Test Recording (discord)

❌ Tests failed

E2E Test Video

@github-actions
Copy link

E2E Test Recording (workers-ai)

❌ Tests failed

E2E Test Video

@github-actions
Copy link

E2E Test Recording (base)

❌ Tests failed

E2E Test Video

@github-actions
Copy link

E2E Test Recording (telegram)

❌ Tests failed

E2E Test Video

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants